package net.dgoon.dnote;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

public class DNoteMain extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        Button counter = (Button)findViewById(R.id.button_counter);
        Button reset = (Button)findViewById(R.id.button_reset);
        counter.setOnClickListener(this);
        reset.setOnClickListener(this);
    }
    
    /** D-Goon's first writing! **/
    public void onClick(View v) {
    	switch (v.getId()) {
    		case R.id.button_counter:
    		{
    			TextView text_count = (TextView)findViewById(R.id.text_count);
    			String count = text_count.getText().toString();
    			int c = Integer.parseInt(count) + 1;
    			text_count.setText(Integer.toString(c));
    		} break;
    		case R.id.button_reset:
    		{
    			TextView text_count = (TextView)findViewById(R.id.text_count);
    			text_count.setText(Integer.toString(0));
    		} break;
    	}
    }
}